<template>
  <div>
    <p v-if='isReadOnlyPage === true'>{{ (value === -1 || value === 0) ? '不限人数' : value }}</p>
    <a-input-number v-else :min="minCount ? minCount : 0" :disabled="disabledCount" :value="value" @change="onchange" style="width:100%" @blur="onBlurFn" />
  </div>
</template>

<script>
export default {
  name: 'INT',
  model: {
    prop: 'value',
    event: 'change'
  },
  // 2020.1.4 迟 添加minCount  是因为int值最小可以为0 特殊情况下最小可为1
  props: ['value', 'isReadOnlyPage', 'placeholders', 'unlimitedNumberValue', 'keys', 'positionHeadcountData', 'isDisabled', 'minCount'],
  computed: {
    disabledCount () {
      if ((this.keys === 'number' && this.positionHeadcountData ? this.positionHeadcountData.length > 1 : false) || this.isDisabled) {
        return true
      } else {
        return this.unlimitedNumberValue
      }
    }
  },
  data () {
    return {
      isShow: true
    }
  },
  methods: {
    onchange (val) {
      this.$emit('change', val)
    },
    onBlurFn () {
      if (this.value) {
        this.$emit('onBlurFn', true)
      }
    }
  }
}
</script>

<style>

</style>
